package com.intellagric.agriecom.controller.utills;

import org.springframework.core.convert.converter.Converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

//Converter<S, T>
//S:source,需要转换的源的类型
//T:target,需要转换的目标类型

public class DateConverter implements Converter<String,Date> {
    @Override
    public Date convert(String s) {
        System.out.println("sss");
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
        Date date=null;
        try {
            date=sdf.parse(s);
        } catch (ParseException e) {
            e.printStackTrace();
        }

        return date;
    }




}
